#include "mempool.h"
#include <stdio.h>
#include <time.h>

int main(void)
{
	clock_t start;
	start = clock();
	memorypool mp(100, 2048, 1024);

	char *m[2048];

	char *p = NULL;
	for (int i = 0; i < 2048; i++)
	{
		m[i] = (char *)mp.alloc();
	}

	for (int i = 200; i < 1000; i++)
		mp.release(m[i]);
	printf("use times: %f\n", (double)(clock() - start));
/*
	char *p2;
	start = clock();
	for (int i = 0; i < 2000000; i++)
	{
		p2 = (char *)malloc(100);
		free(p2);
	}
	printf("use times: %f\n", (double)(clock() - start));
*/
	return 0;
}
